package cn.jiyun.dao;

import cn.jiyun.pojo.Permission;
import cn.jiyun.pojo.Role;
import cn.jiyun.pojo.User;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserDao {

    @Select("select * from t_user where username = #{username}")
    User findUserByUsername(String username);

    @Select("SELECT r.* FROM t_user_role ur, t_role r WHERE ur.role_id = r.id AND ur.user_id = #{id}")
    List<Role> findRoleByUid(Integer id);

    @Select("SELECT p.* FROM t_role_permission rp , t_permission p WHERE rp.permission_id = p.id AND rp.role_id = #{id}")
    List<Permission> findPermissionByRid(Integer id);
}
